package de.jppietsch.gui;

import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: user
 * Date: Feb 14, 2008
 * Time: 11:19:13 PM
 * To change this template use File | Settings | File Templates.
 */
public class MultiRenderer extends DefaultTableCellRenderer {
    JCheckBox checkBox = new JCheckBox();

    public Component getTableCellRendererComponent(JTable table, Object value,
                                                   boolean isSelected, boolean hasFocus, int row, int column) {
        if (value instanceof Boolean) { // Boolean
            checkBox.setSelected((Boolean) value);
            checkBox.setHorizontalAlignment(JLabel.CENTER);
            return checkBox;
        }
        String str = (value == null) ? "" : value.toString();
        return super.getTableCellRendererComponent(table, str, isSelected,
                hasFocus, row, column);
    }
}
